import service from "../index.js";

const elderlyApi = {
    //添加老人
    insert(elderly){
        return service.post('/admin/elder', elderly);
    },
    //根据id删除
    delete(eid){
        return service.delete(`/admin/elder/${eid}`)
    },
    //修改
    update(elderly){
        return service.put('/admin/elder', elderly);
    },
    //查询所有
    selectBypage(pageNum, ename, eusername){
        const params = {
            pageNum: pageNum,
            ename: ename,
            eusername
        };

        //请求参数
        return service.get('/admin/elder', {params});
    },
    //根据id查询
    selectByID(eid){
        return service.get(`/admin/elder/${eid}`)
    },
    selectAllMedical(mname, eid){
        const params = {
            mname: mname
        }
        return service.get('/admin/elder/allmedical', {params})
    },
    insertAddMedical(eid, mids){
        const params = {
            eid: eid,
            mids: mids
        }
        return service.post('/admin/elder/allmedical',params)
    },
    selectMidsByeid(eid){
        return service.get(`/admin/elder/allMedicalIds/${eid}`)
    },
    selectByEidUser(){
        return service.get(`/user/elderly/info`)
    },
    selectElderlyByUser(){
        return service.get('/user/elderly/byEid');
    },updataInfoByUser(elderly){
        return service.put('/user/elderly',elderly);
    }
}
export default elderlyApi;